<template>
	<view >
		<view class="item" v-for="(item, index) in list" @click="itemClick(item)" :key="index">
			<u-image width="138" height="138" :src="item.icon"></u-image>
			<view class="info">
				<view class="name">{{item.menuName}}</view>
				<view class="desc">{{item.desc || ''}}</view>
			</view>
			<view class="action">
				进入
			</view>
		</view>
	</view>
</template>

<script>
	import { mapGetters } from 'vuex'
	export default {
		data() {
			return {
				list: [
					// {name: '销售FAQ', desc: '销售常见问题解答(FAQ)营销', url: 'pages_operate/clientele/faq-page'},
					// {name: '我的FAQ', desc: '销售记录工具', url: 'pages_operate/clientele/faq-my-page'},
					// {name: '线索管理', desc: '当前用户客户列表', url: '/pages_operate/clientele/lead-page'},
					// {name: '我的客户', desc: '当前还未续费的客户列表', url: 'pages_operate/clientele/clientele-page'},
					// {name: '合同添加', desc: '合同添加', url: 'pages_operate/clientele/contact-page'},
				]
			}
		},
		computed: {
			...mapGetters({
				findMenuList: 'user/findMenuList'
			})
		},
		onLoad() {
			this.init();
		},
		methods: {
			init() {
				this.findMenuList('plugin::operate::crm').then(res => {
					console.log(res);
					this.list = res.children;
				}).catch(error => {
					console.log(error);
				})
			},
			itemClick(item) {
				this.$u.route({
					url: item.url
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: $app-page-bg-color;
	}

	.item {
		padding-left: 30rpx;
		padding-right: 30rpx;
		padding-top: 40rpx;
		padding-bottom: 40rpx;
		background: #FFFFFF;
		border-radius: 20rpx;
		
		display: flex;
		flex-direction: row;
		align-items: center;
		margin: 30rpx;
		
		.info{
			flex-grow: 1;
			margin-left: 20rpx;
			.name{
				font-size: 32rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #333333;
			}
			
			.desc{
				font-size: 20rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #999999;
				margin-top: 15rpx;
			}
		}
		
		.action {
			width: 150rpx;
			height: 60rpx;
			background: linear-gradient(0deg, #F5AC3C 0%, #AACD22 100%);
			border-radius: 30rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			
			font-size: 24rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #FFFFFF;
			line-height: 38rpx;
		}
	}
</style>
